package com.qf.web.controller;

import com.qf.entity.CheckGroup;
import com.qf.entity.Result;
import com.qf.entity.SetMeal;
import com.qf.service.SetMealLookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/setlook")
public class SetMealLookController {
    @Autowired
    private SetMealLookService setMealLookService;

    @GetMapping("/byid")
    public Result mealLook(Integer id){
        SetMeal look = setMealLookService.findById(id);

        return Result.success(look);
    }

    @GetMapping("/byno")
    public Result mealLookGroup(){
        List<CheckGroup> byNo = setMealLookService.findByNo();
        return Result.success(byNo);
    }

    @GetMapping("/bygroupid")
    public Result mealLookByGroup(Integer id){
        List<Integer> byGroupId = setMealLookService.findByGroupId(id);
        return Result.success(byGroupId);
    }
}
